package com.ruoyi.wetest.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;

/**
 * @author Allen
 * @description TODO
 * @Date 2024/4/30 18:59
 */
@Configuration
public class WeTestConfig {

    /**
     *是否开启记录事务详情到db库中
     */
    @Value("${wetest.enabledRecordTrans}")
    private boolean enabledRecordTrans;

    /**
     * 上报地址
     */
    @Value("${wetest.dcAddr}")
    private ArrayList<String> dcAddr;



    public String getAcAddr(String pid){
        if (dcAddr.size()==1) return dcAddr.get(0);
        return dcAddr.get(dcAddr.size()% pid.hashCode());
    }

    public boolean isEnabledRecordTrans() {
        return enabledRecordTrans;
    }
}
